/*
 * GridWorld.h
 *
 *  Created on: 11 jan. 2011
 *      Author: Frans
 */

#ifndef GRIDWORLD_H_
#define GRIDWORLD_H_
#include "State.h"
#include "Coordinate.h"
#include "Direction.h"
#include "EpsilonPolicy.h"
#include <string>



class GridWorld {
private:
	State *goal;
	State *current;
	State *start;
	double alfa;
	double gamma;
	State *states [7][7];
	State *getState(Coordinate *coordinate);
	State *getState(Coordinate *coordinate, int direction);
	void initGridWorld(int x, int y);
	void setCurrentState(State *state);
	double calculateNewQValue(State *newState, int direction, int reward);
	double getMaxQValue(State *newState);
	State *getCurrentState();
	State *getGoalState();
public:
	GridWorld(int x, int y, double alfa, double gamma, Coordinate *goal, Coordinate *start);
	bool isInGoal();
	void takeStep(EpsilonPolicy *policy);
	void reset();
	void bestDirection();
	void printQValues();

};

#endif /* GRIDWORLD_H_ */
